Skip to content

London | 26-ITP-JAN | Asha Ahmed | Sprint 2 | Data Groups#1127

Open
ashaahmed7 wants to merge 13 commits intoCodeYourFuture:mainfrom
ashaahmed7:sprint-2
Open

London | 26-ITP-JAN | Asha Ahmed | Sprint 2 | Data Groups#1127
ashaahmed7 wants to merge 13 commits intoCodeYourFuture:mainfrom
ashaahmed7:sprint-2

Conversation

@ashaahmed7
Copy link
Copy Markdown

@ashaahmed7 ashaahmed7 commented Mar 28, 2026

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Completed the exercises in each directory on Sprint 2

Questions

N/A

@ashaahmed7 ashaahmed7 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
console.log(`${recipe.title} serves ${recipe.serves}
ingredients:
${recipe}`);
${recipe.ingredients.join(", ")}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This output does not quite meet the requirement specified on line 5.

Comment on lines +6 to +12
for (let key in object) {
if (key === name) {
return true;
}
}

return false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also considered Object.hasOwn().

// Then it should return false or throw an error
it("contains returns false or throws an error if given parameter is not a valid object", () => {
expect(contains([], "key1")).toEqual(false);
expect(contains([1, 2], 1)).toEqual(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can your function pass this test?

expect(contains([1, 2], "1")).toEqual(false);

Comment on lines +4 to +10
if (itemsList.length === 0) {
return {};
}

if (!Array.isArray(itemsList)) {
throw new Error("Input must be an array");
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the following function call returns the value you expect?

tally(0);
tally(undefined);
tally("");
tally(["toString", "toString"]); 

Note: For the last function call, look up an approach to create an empty object with no inherited properties.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants